var LazySingleton = /** @class */ (function () {
    function LazySingleton() {
    }
    LazySingleton.getInstance = function (name) {
        // input your code 
        if (this.instance === undefined) {
            this.instance = new LazySingleton();
        }
        return LazySingleton.instance;
    };
    return LazySingleton;
}());
var HungrySingleton = /** @class */ (function () {
    function HungrySingleton() {
    }
    HungrySingleton.getInstance = function () {
        // input your code 
        return HungrySingleton.instance;
    };
    // 实例作为静态的私有属性
    HungrySingleton.instance = new HungrySingleton();
    return HungrySingleton;
}());
var lazy_single = LazySingleton.getInstance('LazySingleton');
console.log(lazy_single.name);
var lazy_single2 = LazySingleton.getInstance('LazySingleton');
console.log(lazy_single === lazy_single2);
lazy_single.name = 'test';
console.log(lazy_single.name);
console.log(lazy_single2.name);
var hungry_single = HungrySingleton.getInstance();
console.log(hungry_single.name);
// 输出 true
var hungry_single2 = HungrySingleton.getInstance();
console.log(hungry_single === hungry_single2);
hungry_single.name = 'test';
console.log(hungry_single.name);
console.log(hungry_single2.name);
